:root {
    --primary-color: #4361ee;
    --primary-gradient: linear-gradient(135deg, #4361ee, #3a0ca3);
    --secondary-color: #7209b7;
    --accent-color: #4cc9f0;
    --primary-light: rgba(67, 97, 238, 0.1);
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 5px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --header-height: 70px;
    --sidebar-width: 280px;
    --input-height: 56px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 主容器布局 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background-color: #f8f9fa;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e9ecef;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 20px;
    color: #1f2937;
}

.app-logo i {
    font-size: 20px;
    color: #4361ee;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toggle-sidebar-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-section {
    padding: 16px;
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: white;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.new-chat-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.sidebar-section-title {
    padding: 8px 16px;
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    position: relative;
}

.conversation-item:hover {
    background-color: #f3f4f6;
}

.conversation-item:hover .delete-conversation-btn {
    opacity: 1;
}

.conversation-item.active {
    background-color: var(--primary-light);
    border-left-color: var(--primary-color);
}

.conversation-item i {
    margin-right: 8px;
    color: #9ca3af;
}

.delete-conversation-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}

.delete-conversation-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.conversation-item-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    grid-column: 1 / -1;
    background-color: white;
    border-radius: 16px;
    border: 2px dashed #e5e7eb;
    animation: fadeIn 0.5s ease-out;
}

.empty-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--text-tertiary);
}

.empty-placeholder p {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 500;
}

.empty-placeholder .hint {
    font-size: 14px;
    color: var(--text-tertiary);
}

.history-conversations, .archived-conversations {
    display: flex;
    flex-direction: column;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 8px;
    background-color: #f9fafb;
    font-size: 14px;
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: white;
    color: #dc3545;
    border: 1px solid #f1f1f1;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: #fff5f5;
    color: #b02a37;
    border-color: #dc3545;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #ffffff;
}

.top-nav {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #e9ecef;
}

.chat-tabs {
    display: flex;
    gap: 10px;
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
    font-weight: 500;
    background-color: transparent;
}

.chat-tab:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.chat-tab.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.chat-tab i {
    font-size: 16px;
}

.doc-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.nav-actions {
    display: flex;
    gap: 12px;
}

.tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-panel.active {
    display: flex;
}

.knowledge-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.knowledge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.knowledge-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.kb-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.kb-add-btn:hover {
    background-color: #3850d0;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.knowledge-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.kb-item {
    background-color: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kb-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(67, 97, 238, 0.3);
}

.kb-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-item-header i {
    color: var(--primary-color);
    font-size: 18px;
}

.kb-item-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.kb-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    flex-grow: 1;
}

.kb-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #9ca3af;
}

.kb-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kb-meta i {
    font-size: 14px;
}

.kb-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.kb-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.kb-action-btn:first-child {
    margin-right: 8px;
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.3);
    background-color: rgba(67, 97, 238, 0.03);
}

.kb-action-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.5);
}

/* 聊天区域 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 16px;
    background-color: #f9fafb;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 24px;
    max-width: 85%;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user-message {
    align-self: flex-end;
    background-color: #4361ee;
    color: white;
    padding: 12px 16px;
    border-radius: 16px 16px 0 16px;
}

.ai-message {
    align-self: flex-start;
    color: var(--text-color);
    padding: 12px 24px;
    padding-top: 40px;
    border-radius: 0 16px 16px 16px;
    position: relative;
    max-width: 90%;
    margin-bottom: 16px;
    margin-left: 20px;
}

.think-container {
    margin-top: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(67, 97, 238, 0.2);
    position: relative;
}

.think-toggle {
    background-color: rgba(67, 97, 238, 0.1);
    padding: 10px 14px;
    font-size: 13px;
    color: #4361ee;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 8px 8px 0 0;
    user-select: none;
    font-weight: 500;
}

.think-toggle i.bi-chevron-down {
    margin-left: auto;
    transition: transform 0.2s;
}

.think-toggle.active i.bi-chevron-down {
    transform: rotate(180deg);
}

.copy-btn {
    background: none;
    border: none;
    color: #9ca3af;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 8px;
    padding: 0;
}

.copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.6);
    color: #4361ee;
}

.think-content {
    background-color: rgba(67, 97, 238, 0.03);
    padding: 14px;
    font-size: 14px;
    border-radius: 0 0 8px 8px;
    line-height: 1.6;
    color: #4b5563;
    border-top: none;
    display: none;
}

.markdown-content {
    line-height: 1.6;
    font-size: 15px;
}

.markdown-content p {
    margin-bottom: 12px;
}

.markdown-content pre {
    background-color: #f9fafb;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 12px 0;
}

.markdown-content code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    background-color: #f3f4f6;
    padding: 2px 4px;
    border-radius: 4px;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-content ul, .markdown-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.markdown-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 12px;
    color: #6b7280;
    margin: 12px 0;
}

/* 文件附件区域 */
.attached-files {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.attached-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ebf5ff;
    border-radius: 8px;
    flex-shrink: 0;
}

.file-icon i {
    font-size: 20px;
    color: #4361ee;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #374151;
}

.file-size {
    font-size: 12px;
    color: #6b7280;
}

.remove-file-btn {
    background: none;
    border: none;
    color: #9ca3af;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-file-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.close-preview-btn {
    background: none;
    border: none;
    color: #9ca3af;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.close-preview-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.file-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #6b7280;
    font-size: 13px;
}

/* 输入区域 */
.input-area {
    border-top: 1px solid #e5e7eb;
    padding: 16px;
    background-color: white;
    margin-top: auto;
}

.thinking-options {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.thinking-option {
    background: white;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.thinking-option:hover {
    background-color: #f3f4f6;
    color: #4361ee;
    border-color: #4361ee;
    transform: translateY(-1px);
}

.thinking-option.active {
    background-color: #4361ee;
    color: white;
    border-color: #4361ee;
}

.thinking-option i {
    font-size: 14px;
}

.message-input-wrapper {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    background-color: white;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
}

#user-input {
    flex: 1;
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    resize: none;
    max-height: 150px;
    outline: none;
    background-color: transparent;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: #f3f4f6;
    color: #4361ee;
}

.send-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4361ee;
    transition: all 0.2s;
    box-shadow: none;
}

.send-btn i {
    font-size: 24px;
}

.send-btn:hover {
    transform: translateY(-2px);
    color: #3850d0;
}

.input-footer {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.footer-text {
    font-size: 12px;
    color: #9ca3af;
}

/* 工具菜单 */
.tools-menu {
    position: absolute;
    bottom: 48px;
    right: 48px;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 8px 0;
    min-width: 180px;
    display: none;
    z-index: 100;
}

.tools-menu.active {
    display: block;
}

.tool-item {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.tool-item:hover {
    background-color: #f3f4f6;
    color: var(--primary-color);
}

.tool-item i {
    font-size: 16px;
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    background: #4361ee;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    transform: translateX(150%);
    transition: transform 0.3s ease-out;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
}

.notification-error {
    background: linear-gradient(135deg, #f44336, #c62828);
}

.notification-warning {
    background: linear-gradient(135deg, #ff9800, #ef6c00);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 500px;
    max-width: 90%;
    animation: modalShow 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

@keyframes modalShow {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.close:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.form-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.form-actions button:first-child {
    background-color: #4361ee;
    color: white;
    border: none;
}

.secondary-btn {
    background-color: white;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 100;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .thinking-options {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .attached-files {
        padding: 10px;
    }
    
    .file-prompt {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .thinking-options {
        gap: 8px;
    }
    
    .message-input-wrapper {
        padding: 8px;
    }
    
    #user-input {
        padding: 6px;
    }
    
    .action-btn, .send-btn {
        width: 32px;
        height: 32px;
    }
    
    .send-btn i {
        font-size: 20px;
    }
}

/* 知识库管理菜单 */
.kb-manage-menu {
    position: absolute;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    width: 180px;
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.kb-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-color);
}

.kb-menu-item:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.kb-menu-item i {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.kb-menu-item span {
    font-size: 14px;
}

.kb-menu-item.danger {
    color: #dc2626;
}

.kb-menu-item.danger:hover {
    background-color: rgba(220, 38, 38, 0.08);
    color: #dc2626;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 文档管理 */
.docs-manager-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.docs-manager-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.docs-manager-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    flex: 1;
    text-align: center;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.back-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.3);
    transform: translateY(-1px);
}

.upload-doc-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.upload-doc-btn:hover {
    background-color: #3850d0;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.docs-manager-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0;
}

#documents-list {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    position: relative;
    padding: 0;
}

/* 移除滚动条样式 */
.docs-list::-webkit-scrollbar {
    display: none;
}

/* 加载动画 */
.docs-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.docs-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(67, 97, 238, 0.2);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

.docs-loading-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.doc-item {
    margin-bottom: 0;
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    animation: fadeIn 0.4s ease-out;
}

.doc-item:nth-child(even) {
    animation-delay: 0.1s;
}

.doc-item:nth-child(3n) {
    animation-delay: 0.2s;
}

.doc-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08);
    border-color: rgba(67, 97, 238, 0.3);
}

.doc-item:hover .doc-name {
    color: var(--primary-color);
}

.doc-item:hover .doc-type-badge {
    transform: scale(1.05);
}

.doc-header {
    display: flex;
    align-items: flex-start;
    padding: 18px 18px 10px 18px;
    gap: 14px;
}

.doc-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.doc-icon i {
    font-size: 24px;
    transition: all 0.2s;
}

.doc-item:hover .doc-icon {
    transform: scale(1.08);
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.doc-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.doc-meta i {
    font-size: 14px;
}

.doc-type-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    transition: all 0.2s;
}

.doc-preview {
    padding: 0 18px 14px 18px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    min-height: 60px;
    position: relative;
}

.doc-actions {
    display: flex;
    padding: 12px 14px;
    border-top: 1px solid #f3f4f6;
    background-color: #fafbfc;
    gap: 8px;
    margin-top: auto;
}

.doc-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 6px;
    font-weight: 500;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
}

.doc-action-btn.view-btn {
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.3);
    background-color: rgba(67, 97, 238, 0.03);
}

.doc-action-btn.edit-btn {
    color: #0ea5e9;
    border-color: rgba(14, 165, 233, 0.3);
    background-color: rgba(14, 165, 233, 0.03);
}

.doc-action-btn.delete-btn {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background-color: rgba(239, 68, 68, 0.03);
}

.doc-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.doc-action-btn.view-btn:hover {
    background-color: rgba(67, 97, 238, 0.1);
    border-color: rgba(67, 97, 238, 0.5);
    color: var(--primary-color);
}

.doc-action-btn.edit-btn:hover {
    background-color: rgba(14, 165, 233, 0.1);
    border-color: rgba(14, 165, 233, 0.5);
    color: #0ea5e9;
}

.doc-action-btn.delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

/* 文档详情页面样式优化 */
.doc-content-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.doc-content-header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}

.doc-content-header h2 {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-actions {
    display: flex;
    gap: 8px;
}

.edit-doc-btn, .delete-doc-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-doc-btn {
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.3);
    background-color: rgba(67, 97, 238, 0.03);
}

.delete-doc-btn {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background-color: rgba(239, 68, 68, 0.03);
}

.edit-doc-btn:hover {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.5);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.delete-doc-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.doc-content-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.document-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    line-height: 1.6;
}

.document-metadata {
    width: 280px;
    padding: 24px;
    border-left: 1px solid var(--border-color);
    background-color: #f9fafb;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.doc-meta-item {
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.doc-meta-item i {
    color: var(--primary-color);
    margin-top: 2px;
}

.image-preview {
    margin-bottom: 24px;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.file-action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary, .primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary, .primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover, .primary-btn:hover {
    background-color: #3850d0;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary, .secondary-btn {
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover, .secondary-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.3);
    transform: translateY(-1px);
}

.doc-text-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-color);
}

/* 加载指示器样式 */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-indicator .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .docs-list {
        grid-template-columns: 1fr;
    }
    
    .doc-item {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .docs-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        padding: 16px;
        gap: 16px;
    }
}

/* 添加文档页面样式 */
.add-document-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.add-document-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.add-document-header h2 {
    flex: 1;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    text-align: center;
}

.method-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.method-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.method-tab:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.3);
}

.method-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: white;
    color: var(--text-secondary);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.preview-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: rgba(67, 97, 238, 0.3);
    transform: translateY(-1px);
}

/* 知识库选择器样式 - 紧凑版 */
.kb-selector-container {
    width: 100%;
    padding: 0 1rem;
    margin-bottom: 10px;
    display: flex;
    justify-content: flex-end;
}

.kb-selector-compact {
    position: relative;
    width: auto;
    max-width: 200px;
    min-width: 130px;
    display: flex;
    align-items: center;
}

.kb-selector-compact .kb-select {
    width: 100%;
    padding: 4px 25px 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.kb-selector-compact i {
    position: absolute;
    right: 8px;
    color: var(--primary-color);
    font-size: 0.8rem;
    pointer-events: none;
}

.kb-select option {
    background-color: var(--bg-light);
    color: var(--text-primary);
    padding: 8px;
}

.kb-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

/* 适配移动设备的样式 */
@media (max-width: 768px) {
    .kb-selector-container {
        justify-content: flex-start;
        margin-bottom: 5px;
    }
    
    .kb-selector-compact {
        max-width: 150px;
    }
}